package leetcode.code1701;

public class Solution1 extends Solution1701 {

	@Override
	public double averageWaitingTime(int[][] customers) {
		//
		int start = 0;
		int Len = customers.length;
		double wait = 0;
		for (int i = 0; i < Len; i++) {
			int[] customer = customers[i];
			int arrivali = customer[0];
			int timei = customer[1];
			start = Math.max(start, arrivali);
			int finish = start + timei;
			wait += finish - arrivali;
			start = finish;
		}
		return wait / Len;
	}

	public static void main(String[] args) {
		Solution1 so = new Solution1();
		so.debug1();
		so.debug2();
		so.debug3();
		so.debug4();

	}

}
